package com.iraeta.service.work.impl;

import com.iraeta.dao.main.work.TblogDao;
import com.iraeta.dao.main.work.TbworkDao;
import com.iraeta.entity.main.Tblog;
import com.iraeta.entity.main.Tbwork;
import com.iraeta.entity.main.resulttype.TblogResultType;
import com.iraeta.service.work.TbWorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TbWorkServiceImpl implements TbWorkService {
    @Autowired
    TbworkDao tbworkDao;
    @Autowired
    TblogDao tblogDao;

    @Override
    public Tbwork getTbwork(int workId) {
        return tbworkDao.selectByPrimaryKey(workId);
    }

    @Override
    public void updateTbwork(Tbwork tbwork) {
        tbworkDao.updateByPrimaryKey(tbwork);
    }

    @Override
    public List<Tbwork> listTbwork() {
        return tbworkDao.selectAll();
    }

    @Override
    public List<TblogResultType> listTblog(String beginDate, String endDate) {
        return tblogDao.selectByDate(beginDate, endDate);
    }

    @Override
    public List<Tblog> listTbWorklog(int workId) {
        return tblogDao.selectTblogByWorkId(workId);
    }
}
